﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using ObjectTransposeApi;
using System.Collections;

namespace ObjectTransposeApiSystemTest.TestFixture
{
    [TestFixture]
    public class ToValuePropertyMapperTestFixture
    {
        public class SingleStructure
        {
            public bool Value { get; set; }
        }

        [Test]
        public void SingleTest()
        {
            var sourceOne = new
            {
                ValueOne = true
            };

            List<object> sources = new List<object>();

            sources.Add(sourceOne);

            PropertyMapper propertyMapper = new PropertyMapper("Value", "ValueOne");

            SingleStructure singleStructure = ObjectToValue.Copy<SingleStructure>(
                sources,
                new PropertyMapper[] {propertyMapper});

            // make sure the field was set
            Assert.IsTrue(singleStructure.Value);
        }
    }
}
